﻿using System;

namespace gameS

{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            DataMgr datamgr = new DataMgr();
            //注册
            bool ret = datamgr.Register("LPY_1_1", "123");
            if (ret)
                Console.WriteLine("注册成功");
            else
                Console.WriteLine("注册失败");
            //创建
            ret = datamgr.CreatePlayer("LPY_1");
            if (ret)
                Console.WriteLine("创建玩家成功");
            else
                Console.WriteLine("创建玩家失败");
            //获取玩家数据
            PlayerData pd = datamgr.GetPlayerData("LPY_1");
            if (pd !=null)
                Console.WriteLine("获取玩家成功 分数是"+pd.score);
            else
                Console.WriteLine("获取玩家失败");
            //更改玩家数据
            pd.score += 10;
            Player p = new Player();
            p.id = "LPY_1";
            p.data = pd;
            datamgr.SavePlayer(p);
            //重新读取
            pd = datamgr.GetPlayerData("LPY_1");
            if (pd != null)
                Console.WriteLine("获取玩家成功 分数是" + pd.score);
            else
                Console.WriteLine("获取玩家失败");
            Console.Read();
        }
    }
}
